package com.stack.admin.controller.v1;


import com.stack.admin.service.AdChannelService;
import com.stack.admin.service.AdUserService;
import com.stack.model.admin.dtos.AdChannelDto;
import com.stack.model.admin.dtos.PageQueryDto;
import com.stack.model.admin.pojos.AdChannel;
import com.stack.model.admin.pojos.AdUser;
import com.stack.model.common.dtos.ResponseResult;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author llz
 * @date 2023/11/15 9:20
 * @description
 */
@Api(value= "频道管理")
@RestController
@RequestMapping("/api/v1/channel")
public class AdChannelController {

    @Resource
    private AdChannelService adChannelService;
    /**
     * export const API_CHANNEL_LIST = '/service_6001/admin/api/v1/channel/list'
     * export const API_CHANNEL_SAVE = '/service_6001/admin/api/v1/channel/save'
     * export const API_CHANNEL_UPDATE = '/service_6001/admin/api/v1/channel/update'
     * export const API_CHANNEL_DEL = '/service_6001/admin/api/v1/channel/del'
     */
    @ApiOperation("查询频道列表")
    @PostMapping("/list")
    public ResponseResult getChannelList(@RequestBody PageQueryDto pageQueryDto) {
        return adChannelService.getChannelList(pageQueryDto);
    }

    @ApiOperation("新增频道")
    @PostMapping("/save")
    public ResponseResult saveChannel(@RequestBody AdChannelDto dto){
        return adChannelService.saveChannel(dto);
    }

    @ApiOperation("修改频道")
    @PostMapping("/update")
    public ResponseResult updateChannel(@RequestBody AdChannelDto dto){
        return adChannelService.updateChannel(dto);
    }

    @ApiOperation("删除频道")
    @GetMapping("/del/{id}")
    public ResponseResult deleteChannel(@PathVariable("id") Integer id){
        return adChannelService.deleteChannel(id);
    }

}

